 Delphi 5

Delphi 5

•	 Unzip the files;

•	 Select File | Open... on the menu bar. Set Files of type to Delphi package source, locate and select the ASG_Capture.dpk file, and click Open;

•	 A package editor window will appear. Click Compile, then click Install;

•	 Check the necessary file paths in Tools | Environment Options | Library | Library Path. The path should include Apprehend component directory.

Apprehend2001 will be installed "Samples" in the component pallete.


Introduction

Introduction

With Apprehend 2001 Screen Capture component for Delphi 4 and 5 you can easily implement Screen Capture into an application.  Apprehend 2001 is intended for use in combination with just about any Delphi 5 image library.  Apprehend 2001 was developed with Delphi 5.  Apprehend 2001 has not been tested with Delphi 4 but should function the same as it does with Delphi 5.

Apprehend 2001 has been tested with and includes demo's with source for use with Borland's TImage, Envision's TImageScrollbox and ImageEn's ImageENView.

In normal use all you have to do is place a TASGScreenCapture component on the main form of a project and make one function call to return a TBitmap of the captured image.  With Apprehend you may Capture the desktop, Capture a bitmap image of the active window, Capture a bitmap of a selected object (Window, button, toolbar) or Capture a bitmap of a selected area with four simple functions:

Functions

function CaptureDesktop: TBitmap;

function CaptureActiveWindow: TBitmap;

function CaptureObject: TBitmap;

function CaptureSelection: TBitmap;

To automatically minimize the main form of the application before a capture and to automatically restore the main form, set the Minimize property to true.  If you set minimize property to false, the image will include the application window.  Typically the minimize property will be set to true.

To automatically copy the captured image to the clipboard when set the auto property to true.

To change the time between minimizing the main form and the time that the snapshot takes place set the delay property.  Usually from 50 to 500 is a good setting.  The default is 500.

procedure CaptureDesktopClick( Sender: TSender );

var

BMP: TBitmap;

begin

   // Set the ScreenCapture Component Properties or use properties set in the IDE

   ASGScreenCapture1.Minimize := True;

   ASGScreenCapture1.Auto := True;

   ASGScreenCapture1.Delay := 500;

   // Create a temporary bitmap

   BMP := TBitmap.Create;

   try

      // Capture an image of the desktop and assign it to a bitmap

      BMP.Assign( ASGScreenCapture1.CaptureDesktop );

      //Assign the bitmap to a TImage or another image component

      Image1.Picture.Bitmap.Assign( BMP );

      // Refresh the Image component to display the image

      Image1.Resfresh;

   finally

      // Free the temporary bitmap

      BMP.Free;

   end;

end;

Apprehend 2001 was written with Borland Delphi 5, Patch 1.

Apprehend 2001 has not been tested with earlier versions of Delphi by the author.

Other programmers have sucessfully installed Apprehend 2001 and compiled the Apprehend 2001 demos with Delphi 4.

Other authors report that Apprehend 2001 will not install in Delphi 3.


ASGCapture

ASGCapture

ASGCapture contains the following Classes:

TASGScreenCapture

Apprehend 2001, TASGScreenCapture is a non-visible component to capture images from the screen and places the image into a TBitmap for use with a TImage component or most other image library components.

Apprehend 2001 does not include an image of the cursor in the captured imaage.


TASGScreenCapture

TASGScreenCapture

TASGScreenCapture is a TComponent descendant.

Unit

ASGCapture

Description

Apprehend 2001, TASGScreenCapture is a non-visible component to capture images from the screen and places the image into a TBitmap for use with a TImage component or most other image library components.

ASGScreenCapture has been tested with TImage, Envision's TImageScrollBox and ImageEn's ImageENView Component.

Apprehend 2001 has been designed to work with most any Delphi 5 Image Library.


TASGScreenCapture Properties

TASGScreenCapture Properties

Create

Destroy

CopyToClipboard

CaptureDesktop

CaptureActiveWindow

CaptureObject

CaptureSelection


TASGScreenCaptureMethods

TASGScreenCaptureMethods

Auto

Minimize

Delay


TASGScreenCaptureEvents

TASGScreenCaptureEvents

property OnCapture: TNotifyEvent;

Description

This event fires after a image is captured.


Create

Create

constructor Create ( AOwner: TComponent );

Description  Create a TASGScreenCapture component at run time:

procedure...

var

Capture: TASGScreenCapture;

begin

  Capture := TASGScreenCapture.Create ( Self );

end;


Destroy

Destroy

destructor Destroy; override;

Description Free a TASGScreenCapture component created at runtime.

procedure...

var

ASGScreenCapture1: TASGScreenCapture;

begin

  ASGScreenCapture1.Free;

end;

Do not call Destroy directly. Call Free instead.  Free verifies that the component is not nil, and only then calls Destroy.


CopyToClipboard

CopyToClipboard

procedure CopyToClipboard;

Description

Copies image to clipboard

This procedure is used internally in conjunction with the Automatic property to automatically send the captured image to the clipboard.


CaptureDesktop

CaptureDesktop

function CaptureDesktop: TBitmap;

Description

Capture an image of the desktop

procedure TMainForm.CaptureDesktop1Execute ( Sender: TObject );

var

ASGScreenCapture1: TASGScreenCapture;

begin

  // create a MDI Child form containing a TImage component

  CreateMDIChild ( 'Desktop Image' );

  Child.Image.Picture.Assign ( ASGScreenCapture1.CaptureDesktop );

  with Child.ScrollBox do

  begin

    HorzScrollBar.Range := Child.Image.Picture.Width;

    VertScrollBar.Range := Child.Image.Picture.Height;

  end;

  Child.Image.Refresh;

end;


CaptureActiveWindow

CaptureActiveWindow

function CaptureActiveWindow: TBitmap;

Description

Capture a bitmap of active window

procedure TMainForm.CaptureActive1Execute ( Sender: TObject );

var

ASGScreenCapture1: TASGScreenCapture;

begin

  CreateMDIChild ( 'Active Window Image' );

  Child.Image.Picture.Assign ( ASGScreenCapture1.CaptureActiveWindow );

  with Child.ScrollBox do

  begin

    HorzScrollBar.Range := Child.Image.Picture.Width;

    VertScrollBar.Range := Child.Image.Picture.Height;

  end;

  Child.Image.Refresh;

end;


CaptureObject

CaptureObject

function CaptureObject: TBitmap;

Description

Capture a bitmap of a selected object (Window, button, toolbar)

procedure TMainForm.CaptureObject1Execute ( Sender: TObject );

var

ASGScreenCapture1: TASGScreenCapture;

begin

  CreateMDIChild ( 'Object Image' );

  Child.Image.Picture.Assign ( ASGScreenCapture1.CaptureObject );

  with Child.ScrollBox do

  begin

    HorzScrollBar.Range := Child.Image.Picture.Width;

    VertScrollBar.Range := Child.Image.Picture.Height;

  end;

  Child.Image.Refresh;

end;


CaptureSelection

CaptureSelection

function CaptureSelection: TBitmap;

Description

Capture a bitmap of a selected area

procedure TMainForm.CaptureArea1Execute ( Sender: TObject );

var

ASGScreenCapture1: TASGScreenCapture;

begin

  CreateMDIChild ( 'Selection Image' );

  Child.Image.Picture.Assign ( ASGScreenCapture1.CaptureSelection );

  with Child.ScrollBox do

  begin

    HorzScrollBar.Range := Child.Image.Picture.Width;

    VertScrollBar.Range := Child.Image.Picture.Height;

  end;

  Child.Image.Refresh;

end;


Automatic

Property Automatic: Boolean;

Description

If Automatic is true then copy captured bitmap to clipboard automatically.


Delay

Property Delay: Integer;

Description

Setting for Screen Refresh Time.  The default is 500.  Use a higher value if screen does not refresh soon enough before capture.


Minimize

Property Miminize: Boolean;

Description

Setting to automatically minimize the main form of the application before screen capture and automatically restore the main form of the application after screen capture.

If Minimise is false, then the captured image will include an image of the main form of the application which contains the Apprehend 2000 (TASGScreenCapure) component.


Demos

Demos

Demos for Borland's TImage component, TImageENView by ImageEn and TImageScrollBox (Envision Image Library)and TGraphics32 are provided to show how easy it is to use Apprehend 2001 with most Image Libaries.  A simple MDI demo is also provided.

Demos for the ImageEn, Envision and Graphics32 Image Libaries provide additional features not possible without additional third pary components for TImage.  ImageEn and Envision provide additional file support and other features.  Additional file support may be added to TImage or Graphics32 by employing use of GraphicsEx or Envision Image library.

Keys

This compiled version of Apprehend 2001 uses several hotkeys to speed capturing images.

F7 - Capture an image of the screen or desktop. No user intervention is required.  An image of the entire screen will be captured and sent to Apprehend 2001.

F8 - Capture an image of a selected area of the screen.  After selecting Capture Area, locate the upper left corner of the area you wish to capture and press and hold the left mouse button down, then drag the mouse to the right and down to show an animated scrolling black and white box.  When finished selecting the area release the left mouse button.  The selected area of the screen is captured and sent to Apprehend 2001.

F9 - Capture the active window. Make sure an application window or program is active then select capture active window.  An image of the active window will be captured and sent to Apprehend 2001.

F10 - Capture window or object.  Make sure an application window or program is active, then select Capture Window or Object.  When the finger cursor appears, hold the cursor over the window or object (button, panel, listbox...) you wish to capture then press the left mouse button.  The selected window or object is sent to Apprehend 2001.

All image capture functions are avaiable from the system menu when the Apprehend 2001 is active or if the Apprehend 2001 is minimized.


TGraphic32

TGraphic32

Graphics32 is a set of functions, classes, components and controls designed for high-performance graphics programming.

Being highly specialized for 32-bit pixel format, it provides fast operations with pixels and graphic primitives and in most cases Graphics32 considerably outperforms standard TBitmap/TCanvas classes.

The library comes with a full source code, documentation and examples.

The library is created and maintained by Alex Denisov.

The Graphics32 Home page is http://www.geocities.com/den_alex

E-mail: denisso@uwindsor.ca

There is also a mailing list at http://groups.yahoo.com/group/g32, there you may find some information on bug fixes new features as well as to get some answers to your questions.


TImage (Borland) Demo

TImage by Borland Inprise Apprehend 2001 Demo

Description

A demo of Apprehend for Borland's Image Component (Ships with Delphi 4 & 5) is located in the \TImage Folder.

TImage displays a graphical image.

Use TImage to display a graphical image on a form. Use a TPicture object to specify the actual bitmap, icon, metafile, or other graphic object displayed by TImage. TImage introduces several properties to determine how the image is displayed within the boundaries of the TImage object.

To add an image to a form or data module so that it is available for display by other controls, use TImageList instead.


TImageScrollBox (Envision) Demo

TImageScrollBox (Envision) Demo

TImageENView by ImageEn Apprehend 2001 Demo

Description

A demo of Apprehend for the ImageEn Image Library is located in the \TImageENView Folder.

ImageEn is a component suite for image processing, viewing and analysis. It can load and save from various image file formats, acquire from TWain scanners (single and multi pages), capture videos, applies filters, merge images, and other.

ImageEn allows you to include professional graphics software features in your applications.

ImageEn works on Delphi 3, Delphi 4, Delphi5, C++Builder 3, C++Builder 4 and C++Builder 5.

ImageEN is a shareware product available at http://web.tiscalinet.it/encomps/

Features

Input/output

•	Load and save JPEG (RGB, GrayScale, YCbCr, CMYK, YCbCrK) to file or stream (with also 1/2, 1/4 and 1/8 subsizes for fast preview).

•	Load and save TIFF (rev.6.0, Packbits, LZW, CCITT G.3 and G.4) with RGB, CMYK and B/W color spaces to file or stream.

•	Load and save PNG with various compression levels.

•	Load and save compressed and uncompressed BMP in 2,16,256 or 16M colors to file or stream.

•	Load and save compressed and uncompressed PCX in 2,16,256 or 16M colors to file or stream.

•	Load and save 2,4,8,16,32,64,128 or 256 colors GIF to file or stream.

•	Load WMF, EMF, ICO and CUR.

•	Load and save AVI, animated GIF and multi-TIFF.

•	Support for user defined file formats

•	Editing of animated GIF: extract, insert and delete single images.

•	Editing of multi TIFF: extract, insert and delete single images.

•	Included source code of a sample plug-in to read/write LZW Gif and TIFF.

•	NON-LZW-GIF compressor sample plug-in for GIF.

•	Standard LZW compressor/decompressor sample plug-in for GIF and TIFF.

•	Get image properties without load it.

•	Image acquisition from TWAIN scanners with full control of the scanner capabilities and without default scanner user interface.

•	VCL component for video capture (freeze frames, save AVI files and real time frames processing). Supports all codec installed and video capture cards.

•	Save/load specific file format parameters and save/load preview dialogs (e.g. you can set quality of a Jpeg and view immediately the quality loss).

•	A property to select dialogs language (english, italian, german, spanish, french, Portuguese).

•	Connections with standard TImage component.

•	OnProgress event for monitoring saving and loading.

•	Allow to abort input/output processing

Image processing & analysis

•	Regulation of contrast, HSL, HSV/ HSB and RGB components.

•	Six filters for quality resampling (rfTriangle, rfHermite, rfBell, rfBSpline, rfLanczos3, rfMitchell).

•	Application of 3x3 filters.

•	Merge two images.

•	Crop selected region.

•	Preview of all the effects in a single dialog, with 8 preset filters (blur, edge detection, emboss, highpass1/ 2/ 3, lowpass1/ 2) and save and load filters from file.

•	Conversion to gray scale and negative.

•	Conversions of true color to black/white images with ordered or threshold dithering.

•	Casting of a group of colors to a single color.

•	Rotate any angle (optional antialiasing).

•	Horizontal and vertical flip.

•	Bump mapping effect

•	Lens effect

•	Wave effect

•	Write/read hidden text, picture and raw data inside images (pixel amplitude modulation)

•	Copy, cut, paste and paste into a rectangle of all or part of the image.

•	Undo last operation: automatic or manual.

•	Application effects to the selected zones (also irregular)

•	OnProgress event for monitoring image processing tasks.

•	Histogram equalization (auto and manual) and threshold.

•	Median cut and Neural network color quantizers, for fast and accurate color reduction.

•	Reduction to any number of colors (with colormap output).

•	HSV channels separations.

•	A property to select dialogs language (english, italian, german, spanish, french, Portuguese).

•	A dialog to view a palette and select on it a color.

•	VCL component for HSV/ HSB color selection.

•	VCL component for displaying histogram of gray levels (or RGB channels).

•	Connections with standard TImage component

Image rendering

•	Real time Zoom-in and zoom-out (by percentage, zoom in rectangular area or by one mouse click).

•	Quality zoom with six filters (you can select between fast zoom or quality zoom).

•	Scrollbar in two dimensions (real time) for the fast exploration of the image, and "hand navigation" (click and drag the image with mouse).

•	Animate bi-color contour of a selected region (polygonal,irregular,circular and rectangular).

•	Multi polygonal animated regions.

•	Dithering for non-true color display adapters.

•	VCL component to implement interactive rules with grips and numeric labels.

•	VCL component for interactive gradient bar.

•	Single VCL component to display thumbnails, grids of images, and animating them.

Database handling

•	Dataware component (TImageEnDBView) integrated with Delphi database environment (saves and loads Bmp,Pcx,Jpeg,TIFF,PNG and Gif in to Blob fields).

Vectorial objects handling

•	a component to handle vectorial objects (lines, box, circles, ellipses, bitmaps and text) over background image. Save/Load these objects and import a sub-set of Autocad DXF files.

•	lines, perimeters and areas measurement (in pixel, inch, cm, mm, Km).

•	saves/loads IEV format (compressed with Deflate, variation of LZ77 algorithm) that includes images and vectorial objects.

(c) 1999 by Encomps


TImageENView (ImageEN) Demo

TImageScrollBox (Envision Image Library) Apprehend 2001 Demo

Description

A demo of Apprehend for the Envision Image Library is located in the \TImageScrollBox Folder.  The Envision Image Library augments Inprise's Delphi and C++ Builder software development environment with powerful imaging capabilities. The library provides image file I/O for popular file formats, printing, scanning, and image processing features. It is for 32 bit development using version 3, 4, 5 of Delphi, or C++ Builder 4.

The Envision Image Library is shareware and may be downloaded at http://www.intervalsoftware.com/download.html

Features

Supported File Formats

•	BMP format, related class TBitmapGraphic

•	Reads 1, 4, 8, 16, 24 bit images, Windows and OS/2 format, non compressed and RLE (run length encoded). Does not read RLE with 24 bit images

•	Writes 1, 4, 8, 24 non compressed

•	ICON format, related class TIconGraphic

•	Read and write

•	JPEG format, related class TJpegGraphic

•	Reads 8 bit grayscale and 24 bit true color

•	Write 8 bit grayscale and 24 bit true color

•	Supports specifying the save quality, progressive save, and optimized Huffman codes

•	Metafile (EMF,WMF), related class TMetaFileGraphic

•	Read WMF,EMF files by converting them to 24 bit true color files

•	Writes to WMF,EMF with a single bitmap object

•	A metafile is not a native bitmap format, but rather a vector format which stores GDI "instructions". The Envision library will read these images by converting them to a bitmap format. To preserve the vector aspects of the file it is preferable to manipulate this file format with Delphi's TMetaFile class.

•	PCX,PCC format, related class TPcxGraphic

•	Reads 1, 4, 8 and 24 bit images supporting RLE compression

•	Writes 1, 4, 8 and 24 bit images with RLE compression

•	DCX related class TDcxGraphic

•	The DCX format is a multi-image PCX format. Reads and writes the same image types as the PCX format.

•	PNG format, related class TPngGraphic

•	Reads 1, 4, 8, 16, 24, and 48 bit images

•	Writes 1, 4, 8, and 24 bit images

•	Supports reading alpha channel, gamma adjustments, progressive saving, and variable compression levels.

•	TGA, VST, AFI format, related class TTgaGraphic

•	Reads 8 and 24 bits non compressed and RLE compressed files.

•	Writes 8 and 24 bits non compressed

•	TIFF format, related class TTiffGraphic

•	Reads 1, 4, 8, 16, 24, 32 bit images

•	Writes 1, 4, 8, 24 bit images

•	Reads and writes uncompressed, CCITT group 3 1D, CCITT group 3 2D, CCITT group 4, Packbits, ZLib (deflate), and JPEG.

•	Supports reading tiled images.

•	Supports reading and writing multi-page files.

Displaying Images

The Envision library integrates with Delphi's TImage component. The TDibGraphic class, is derived from Delphi's TGraphic, which may loaded as the Graphic of a TPicture. Here's a summary of how the TImage component is organized:

TImage contains a TPicture

TPicture contains a TGraphic

The Graphic property of a TPicture may be assigned any TGraphic derived class, for example, with the Envision library any class derived from TDibGraphic.

The most straight forward way to display an image to drop a TImage component on a form, then use the LoadFromFile method of the Picture property. For, example,

Image1.Picture.LoadFromFile('c:.tga');

This requires that the appropriate unit supporting the graphic format must be included in the uses clause. In this case for TGA files, the EnTgaGr unit must be included.

The TImageScrollBox component allows viewing and accessing images easily. It offers much more flexibility than Delphi's TImage component, while remaining very easy to use. This topic details the common steps performed with the TImageScrollBox component.

The first step is always to create an instance of a TImageScrollBox. This may be done by simply dropping a TImageScrollBox component on a form, or creating it at run-time. To create the component at run-time, add a data member in the TForm class.

Reading a multi-page image files

Multi-page image files allow storing multiple images in a singe file. Example of such formats are TIFF and DCX. There are two approaches to read a multi-page image file; to load all the images in memory, or to load the images one at a time. Obviously, loading all the images in memory requires more resources and should only be used for files that contain a relatively small number of images.

Printing

The TDibGraphicPrinter class allows printing any TDibGraphic instance. The PrintMode property determines the size, and how the image will be stretched on the output device.

Scanning

The TScanner class allows acquiring images from TWAIN compliant image devices. TWAIN is an open standard created by several companies for image aquisition. More information on TWAIN is available from http://www.twain.org. With 32 bit applications, the following files, available from the TWAIN web site, and often included with the installation software of a scanner, must be present in the Windows directory

Image Transformations

Image transforms with the Envision library imply any type of transformation which modifies an image. Each image transform derives from the class TImageTransform. There are two methods to perform a transformation, Apply, and ApplyOnDest. The Apply method peforms the transformation on a single TDibGraphic instance, while the ApplyOnDest method, performs the transformation on a destination TDibGraphic, while keeping the source graphic intact. Using an image transform is simple; create the appropriate transform object, set any properties pertaining to the transform, use the desired apply method, then destroy the transform object.

Acessing Individual Pixels

The TDibGraphic class provides fast access to individual pixels using the RGB and PaletteIndex properties. These properties enable reading/writing the value on any pixel. The RGB property may be used for both true color images, where each pixel contains an explicit (red,green,blue) triplet, or for palettized images, where the value of a pixel is an index in it's palette. When using the RGB property with palettized images, a fast caching algorithm is used to translate the RGB triplet to the neareast matching palette entry. When possible, with images that contain a palette (16 and 256  colors, 16 and 256 shades of gray, and black & white), use the PaletteIndex property, which does not require a conversion.

(c) 1999 Interval Software


Additional File Support

Additional File Support

Additional file support (PNG, TIF, GIF etc.) may be added to the TImage or GraphicEX demos by adding supporting Third Party units to the uses clause such as Envision, GraphicEX or other third party units avaiable on the internet.

GraphicsEx

GraphicEx is an addendum to Delphi's Graphics.pas in order to enable your application to load many common image formats. This library is primarily designed to load images as background (buttons, forms, toolbars) and textures (DirectX, OpenGL) or for image browsing and editing purposes as long as you don't need to save images. Currently only TTargaGraphic supports also storing an image, but this might change in the future depending on the external support and success for GraphicEx.

GraphicEx is freeware, but only for non-commercial use.

homepage: www.lischke-online.de

(c) 1999 - 2000 Dipl. Ing. Mike Lischke, all rights reserved


Freeware

Freeware License

This notice may not be removed from or altered in any source distribution.

Apprehend 2001 is distributed as a freeware. You are free to use Apprehend 2001 as part of your application for any purpose including freeware, commercial and shareware applications, provided some credit is given.

Commercial redistribution of library source is allowed only with written permisson from the author.

This software is provided 'as-is', without warranty of any kind, either expressed or implied. In no event shall the author be held liable for any damages arising from the use of this software.


Copyright

Copyright

Apprehend 2001, TASGScreenCapture for Delphi 5

Adirondack Software & Graphics

(C) Copyright Adirondack Software & Graphics 1996-2001


Update

Update

Apprehend 2001 was written by William Miller with Delphi 5.

Email

w2m@netheaven.com

WebSite

http://www.software.adirondack.ny.us


Bugfixes 1.0
BugFixes

1.0

Since this is the first release of Apprehend there are no known bug fixes.

Apprehend originally began a freeware and shareware applications distributed with source.  Development ocurred periodically over a period of 7 or 8 years.  Apprehend source was converted to a non-visible component about a year ago.  Apprehend has been tested extensively over the period by a number of programmers.

Any that finds any bugs should contact me and provide any changes made to the component.